package org.larkdoc.service.impl;

import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.larkdoc.dao.GroupRelUserMapper;
import org.larkdoc.model.entity.GroupRelUser;
import org.larkdoc.service.GroupRelUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 项目与用户业务功能实现类
 * 
 * @author  zhangpeijun[zhangpeijun1024@qq.com]
 * @version  [v1.0.1, 2017年10月17日]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
@Service("groupRelUserService")
public class GroupRelUserServiceImpl implements GroupRelUserService {
    
    @Autowired
    private GroupRelUserMapper groupRelUserMapper;
    
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return groupRelUserMapper.deleteByPrimaryKey(id);
    }
    
    @Override
    public int insert(GroupRelUser record) {
        return groupRelUserMapper.insert(record);
    }
    
    @Override
    public int insertSelective(GroupRelUser record) {
        return groupRelUserMapper.insertSelective(record);
    }
    
    @Override
    public GroupRelUser selectByPrimaryKey(Integer id) {
        return groupRelUserMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public int updateByPrimaryKeySelective(GroupRelUser record) {
        return groupRelUserMapper.updateByPrimaryKeySelective(record);
    }
    
    @Override
    public int updateByPrimaryKey(GroupRelUser record) {
        return groupRelUserMapper.updateByPrimaryKey(record);
    }
    
    @Override
    public int deleteByGroupId(Integer groupId) {
        if (groupId > 0) {
            return groupRelUserMapper.deleteByGroupId(groupId);
        } else {
            return 0;
        }
    }
    
    @Override
    public int insertBatch(List<GroupRelUser> records) {
        if (CollectionUtils.isNotEmpty(records)) {
            return groupRelUserMapper.insertBatch(records);
        } else {
            return 0;
        }
    }
    
}
